function [Xc1]=t2dto3d(xi,l,Pcam,x,y)

%2D PARA 3D , coordenada 3D en relacion a la camara

xi=xi';
RP=[Pcam(1,1)-l*cos(x)*sin(y)  Pcam(1,2)+ l*sin(x)  Pcam(1,3)-l*cos(x)*cos(y)];
TR=[-xi(1,1)  sin(x)*sin(y)  1-(cos(x)^2)*(1-cos(y));
 -xi(1,2)  cos(x)  sin(x)*cos(x)*sin(y)*(1-cos(y));
 -xi(1,3)  sin(x)*cos(y)  -sin(y)];

Gm=inv(TR)*RP';
%ecuaciones parametricas

Xc1(1,1)=l*cos(x)*sin(y)+ Gm(2,1)*sin(x)*sin(y)+Gm(3,1)*(1-(cos(x)^2)*(1-cos(y)));
Xc1(1,2)=-l*sin(x) + Gm(2,1)*cos(x) + Gm(3,1)*sin(x)*cos(x)*sin(y)*(1-cos(y));
Xc1(1,3)=l*cos(x)*cos(y) + Gm(2,1)*sin(x)*cos(y)-Gm(3,1)*sin(y);
Xc1(1,4)=1;

end